/**
 * A Unique Button Class to handle Market Exchanges
 */
package View;

import javax.swing.JButton;

/**
 * This class extends JButton so that buttons in the market can store
 * helpful information.
 * @author Whitney
 *	@version 1.2
 */
public class MarketButton extends JButton {
	
	/**
	 * Number of goodType;
	 */
	private int goodType;

	/**
	 * String for each good
	 */
	private String goodKey;
	
	/**
	 * This method returns the position of the good in the 
	 * TradeGoods array
	 * @return the int that details the location of the item in the trade good array
	 */
	public int getGoodType(){
		return goodType;
	}
	
	/**
	 * Sets the trade good type upon instantiation of the button
	 * @param newGood the in that details to location of the item in the trade good array
	 */
	public void setGoodType(int newGood){
		goodType = newGood;
		initGoodKey();
	}
	
	/**
	 * This method turns a button completely on or off. It not only disables the button,
	 * but makes it invisible
	 * @param input
	 */
	public void buttonSwitch(boolean input){
		setEnabled(input);
		setVisible(input);
	}

	/**
	 * @return the goodKey
	 */
	public String getGoodKey() {
		return goodKey;
	}

	/**
	 * this method sets the goodKey
	 */
	private void initGoodKey() {
		switch(goodType){
		case 0://marketKeys[0] = "Water";
			goodKey = "Water";
			break;
		case 1://marketKeys[1] = "Furs";
			goodKey = "Furs";
			break;
		case 2://marketKeys[2] = "Food";
			goodKey = "Food";
			break;
		case 3://marketKeys[3] = "Ore";
			goodKey = "Ore";
			break;
		case 4://marketKeys[4] = "Medicine";
			goodKey = "Medicine";
			break;
		case 5://marketKeys[5] = "Narcotics";
			goodKey = "Narcotics";
			break;
		case 6://marketKeys[6] = "Firearms";
			goodKey = "Firearms";
			break;
		case 7://marketKeys[7] = "Robots";
			goodKey = "Robots";
			break;
		case 8://marketKeys[8] = "Machines";
			goodKey = "Machines";
			break;
		case 9://marketKeys[9] = "Games";
			goodKey = "Games";
			break;
		default:
			goodKey = "";
			break;
		}
	}
}
